{% extends "base.html" %}
  {% block content %}
    {% from "forms/macros.html" import render_field_busqueda %}
    <SCRIPT LANGUAGE="JavaScript">
	
		url = "/lineabase/informe/ID/"
		url2 = "/lineabase/eliminar/ID/"
		
		id_href = 'inf'
		id_href2 = 'eli'
		
		function obtener_id(id) {
        	link = document.getElementById(id_href)
        	link2 = document.getElementById(id_href2)
        	new_url = url.replace('ID', id)
        	new_url2 = url2.replace('ID', id)
        	link.href = new_url
        	link2.href = new_url2
        
		}
		
		function pregunta(){
    		if(confirm('Esta seguro de que desea eliminar el la linea base?')){
    			return true;
    		}else{
    			return false;
    		}
    	}
    	
	</SCRIPT>
	<h2><center> Administración de Líneas Base </center> </h2>
    <form method="POST" action={{url_for('lineas_base.administracion_lb')}} class="form"><center>
         {{ form.csrf_token }}  
    <div style="overflow:auto; width: 770px; height: 550px;" >
         <table>
         <tr>
              <th></th>
              <th><label>Filtros</label> </th>
              <th>{{ render_field_busqueda(form.nombre, class="input text") }}</th>
              <th>{{ render_field_busqueda(form.estado, class="input text") }}</th>
              <th>{{ render_field_busqueda(form.fase, class="input text") }}</th>
        </tr>                         
              <tr>
                  <th></th>
                  <th><center>ID </center></th>
                  <th><center> NOMBRE </center></td>
                  <th><center> ESTADO </center></td>
                  <th><center> FASE </center></td>
        </tr >                 
                {% for lb in lbs %}                 
                      <tr >
                          <th><input type = "radio" name = "seleccionado" id="select" onchange="obtener_id({{lb.id}})"></th>
                          <td> <center>{{ lb.id }} </center></td>
                          <td> <center>{{ lb.nombre }} <center></td>
                          <td> <center>{{ lb.estado }} <center></td>
                          <td> <center>{{ lb.fase.nombre }} <center></td>
                       </tr>                  
                {% endfor %}
               
       </table>
       </div>
       </br> 
       <div class="buttons">
        	<button type="submit" class="button green">
        	Buscar
        	</button>
        	<button type="submit" class="button green">
                <a href="{{ url_for('lineas_base.seleccionar_fase') }}">Crear</a>
        	</button>
        	<button type="submit" class="button green">
                <a href="" id="inf">Informe</a>
        	</button>
        	<button type="submit" class="button green" onclick =  "return pregunta()">
                <a href="" id="eli">Eliminar</a>
        	</button>
        </div>  
                 
   </center> </form>
   
   
  {% endblock %}